home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gold Medal Software 2
/
Gold Medal Software Volume 2 (Gold Medal) (1994).iso
/
windows
/
win31
/
macsyma.arj
/
MACSDEMO.EXE
/
BALLISTI.OUT
< prev
next >
Wrap
Text File
|
1993-09-15
|
3KB
|
60 lines
(c1) /* Trajectory of a Cannon Ball with Gravity and Air Resistance
Y(t) = Vertical distance travelled
X(t) = Horizontal distance travelled
M = Mass
B = Air damping coefficient
G = Gravitational constant
*/
depends( [x,y], t )$
(c2) assume( b>0 )$
(c3) /* Specify governing differential equations */
eqy : m*diff(y,t,2) = - m*g - b*diff(y,t);
|$label(0,15,Times New Roman,$(d3$))m$hinge()$in( )$q($sup(d,2)y,d$sup(t,2))$hinge()$in( = )$in( - )b$in( )$q(dy,dt)$hinge()$in( - )g$in( )m
(c4) eqx : m*diff(x,t,2) = -b*diff(x,t);
|$label(0,15,Times New Roman,$(d4$))m$hinge()$in( )$q($sup(d,2)x,d$sup(t,2))$hinge()$in( = )$in( - )b$in( )$q(dx,dt)
(c5) /* Find general solutions with arbitrary initial conditions. */
gen_sol : ode2( eqy, y, t );
C:\MACSD2B\ode\ode2.fas being loaded.
|$label(0,15,Times New Roman,$(d5$))y$hinge()$in( = )%k2$in( )$sup($e(),$in( - )$q(b$in( )t,m))$hinge()$in( - )$q(b$in( )g$in( )m$in( )t$in( - )g$in( )$sup(m,2),$sup(b,2))$hinge()$in( + )%k1
(c6) ysol : ic2( gen_sol, t=0, y=0, diff(y,t)=v0*sin(theta) );
|$label(0,15,Times New Roman,$(d6$))y$hinge()$in( = )$in( - )$q($sup($e(),$in( - )$q(b$in( )t,m))$in( )$paren(b$in( )m$in( )sin$paren($greektext(q))$in( )v0$in( + )g$in( )$sup(m,2),$(,$)),$sup(b,2))$hinge()$in( + )$q(m$in( )sin$paren($greektext(q))$in( )v0,b)$hinge()$in( - )$q(b$in( )g$in( )m$in( )t$in( - )g$in( )$sup(m,2),$sup(b,2))
(c7) gen_sol : ode2( eqx, x, t );
|$label(0,15,Times New Roman,$(d7$))x$hinge()$in( = )%k2$in( )$sup($e(),$in( - )$q(b$in( )t,m))$hinge()$in( + )%k1
(c8) xsol : ic2( gen_sol, t=0, x=0, diff(x,t)=v0*cos(theta) );
|$label(0,15,Times New Roman,$(d8$))x$hinge()$in( = )$q(m$in( )cos$paren($greektext(q))$in( )v0,b)$hinge()$in( - )$q(m$in( )$sup($e(),$in( - )$q(b$in( )t,m))$in( )cos$paren($greektext(q))$in( )v0,b)
(c9) /* Insert numerical values into the general solutions. */
params : [ g=9.8, b=0.1, m=10, v0=1000, theta=sfloat(%pi/4) ]$
(c10) xnum : rhs(xsol), params;
|$label(0,15,Times New Roman,$(d10$))70710.7$hinge()$in( - )70710.7$in( )$sup($e(),$in( - )0.01$in( )t)
(c11) ynum : expand(rhs(ysol)), params;
|$label(0,15,Times New Roman,$(d11$))$in( - )168710.6$in( )$sup($e(),$in( - )0.01$in( )t)$hinge()$in( - )980.0$in( )t$hinge()$in( + )168710.6
(c12) /* Compute the time at which the ball hits the ground. */
thud : root_by_bisection(ynum,t,0.,1000.);
C:\MACSD2B\share\bisect.fas being loaded.
|$label(0,15,Times New Roman,$(d12$))120.625
(c13) xnum, t=thud;
|$label(0,15,Times New Roman,$(d13$))49545.8
(c14) paramplot(xnum,ynum,t,0,thud,
"X","Height","Plot of Height Against X Coordinate")$
(c15) /* Clean up */
(remove([x,y],dependency),forget(b>0),
remvalue(eqx,eqy,gen_sol,params,thud,xnum,xsol,ynum,ysol))$